Skip to content

Redact admin passwords from default studio list JSON - #4730

Open
chubes4 wants to merge 2 commits into
trunkfrom
fix/4729-redact-list-json-secrets
Open

Redact admin passwords from default studio list JSON#4730
chubes4 wants to merge 2 commits into
trunkfrom
fix/4729-redact-list-json-secrets

Conversation

@chubes4

@chubes4 chubes4 commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Closes #4729.

Summary

  • studio list --format=json no longer emits adminPassword, TLS material, or other secret fields on stdout.
  • Inventory JSON still includes site identity, path, status, runtime, version, and URL fields for automation.
  • studio status --format=json is audited the same way and no longer emits adminPassword.
  • Credential retrieval stays on the existing explicit single-site command: studio config get admin-password. Do not log that value.
  • Desktop/local IPC listSites() still receives the full record so GUI credential flows are unchanged.

Root cause

studio list --format=json serialized each site with ...site, so the entire stored site record — including encoded adminPassword and any extra secret fields — was dumped to stdout. Table output never showed passwords, so JSON had a surprising secret surface.

Verification

  • npx vitest run apps/cli/commands/site/tests/list.test.ts apps/cli/commands/site/tests/status.test.ts apps/cli/lib/tests/site-secret-fields.test.ts (19 passed)
  • npx eslint on the changed CLI files (no findings)
  • Contract tests assert list JSON contains no password/secret keys or values, while keeping non-secret inventory fields

AI assistance

OpenAI gpt-5.6-sol via OpenCode general coding subagent inspected the CLI list/status serializers, implemented the redaction, added contract tests, and opened this PR. Chris Huber directed the work and remains responsible for the change.

Keep inventory machine output non-secret and send credential retrieval through `studio config get admin-password`.
@wpmobilebot

wpmobilebot commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 6dfdc00 vs trunk

app-size

Metric trunk 6dfdc00 Diff Change
App Size (Mac) 1456.76 MB 1456.76 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 6dfdc00 Diff Change
load 1174 ms 1167 ms 7 ms ⚪ 0.0%

site-startup

Metric trunk 6dfdc00 Diff Change
siteCreation 7522 ms 7512 ms 10 ms ⚪ 0.0%
siteStartup 2885 ms 2887 ms +2 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@wojtekn
wojtekn requested a review from a team September 10, 2026 11:04
@wojtekn

wojtekn commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Hi @chubes4 ! I merged trunk in, confirmed build works fine, and tested it. The main fix is correct and I verified it works.

Would you mind checking those?

  1. The AI assistant can no longer find passwords, but still thinks it can.

Studio's built-in AI assistant reads that same output. So it lost access to passwords too. That's fine on its own — but three places in the code still tell the assistant "this command gives you credentials." So if you ask it "what's my admin password?", it confidently runs the command, gets nothing, and either gives up or makes one up.

Worse: there's no backup route. The PR says "use studio config get admin-password instead," but the assistant has no such tool. It's a dead end.

Fix: edit those three sentences to stop promising credentials.

  1. A different command still leaks the password.

studio config get --format json prints the password in plain text. The PR didn't touch it — but the PR's own docs list that command alongside the fixed ones and say they all hide secrets. So someone reads the docs, trusts it, pipes it to a log file, and leaks the password anyway. Exactly the problem this PR set out to solve.

Fix: either patch that command too, or correct the sentence.

  1. The filter blocks three specific names, not "secrets" generally.

The code removes three fields by name. The PR describes this as removing "any extra secret fields" — it doesn't. If someone adds a new secret field later, it gets printed until a person remembers to add it to the list.

Safer approach: instead of listing what to hide, list what to show. Then anything new is hidden by default.

Minor: two of the three names on the list (tlsKey, tlsCert) aren't stored in this file at all, so they never do anything. Harmless, just noise.

  1. Two small notes
  • The code converts the same data to text twice in a row. Costs nothing, just slightly untidy.
  • The PR quietly fixed a second leak nobody mentioned: when a command crashes, Studio sends the error report to its crash-tracking service — and that report used to include the passwords. Now it doesn't. Worth putting in the description; it makes the PR look better than it currently does.

@wojtekn
wojtekn self-requested a review September 10, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redact site admin passwords from Studio list JSON

3 participants